package com.ly.mpayment.core.util;

import net.sf.json.JSONObject;

/**
 * 消息成功或失败 提示  系统使用
 *
 *
 */
public class ResultMessage {

	// 调用成功
	public static Message succeed = new Message(null, "0", Config.SUCCESS);

	// 调用失败
	public static Message failt = new Message(null, "1", Config.Failt);

	public static Message phoneError = new Message(null, "3", "手机号不能为空或者手机格式错误!");

	public static Message passwordError = new Message(null, "4", "确认密码与原密码不匹配!");

	public static Message smsError = new Message(null, "5", "请求太过频繁,请稍后再试!");

	public static Message smsCodeError = new Message(null, "6", "验证码错误,请重新输入!");

	public static Message loginSuccee = new Message("0", "0", Config.SUCCESS);

	public static Message recoveryError = new Message(null, "7", "验证码错误!");

	public static Message notAuthority = new Message(null, "8", "无权限访问!");

	public static Message registerError = new Message(null, "9", "此用户已经注册!");

	public static Message parameterError = new Message(null, "10", "参数错误!");

	public static Message addShopIpError = new Message(null, "11", "渠道商ip地址重复!");

	public static Message addShopNumError = new Message(null, "12", "渠道编号重复!");

	public static Message addShopNameError = new Message(null, "13", "渠道名称重复!");

	public static Message addUserError = new Message(null, "14", "该手机号已经存在!");

	public static Message deleteAdminError = new Message(null, "16", "管理员不能被删除!");

	public static Message generLogoError = new Message(null, "18", "系统logo未配置,请联系管理员!");

	public static Message addOrderkError3 = new Message(null, "26", "该订单不存在,请刷新重试!");

	public static Message searchShopOrderError = new Message(null, "27", "参数错误!");

//	public static Message parameterError = new Message(null, "28", "参数错误!");


	public static Message sessionError = new Message(null, "31", Config.login);

	public static Message sessionOverdueError = new Message(null, "32", "您的账号已经在其他地方登录,请重新登录,如不是本人操作,请及时更改密码!");

	public static Message systemError = new Message(null, "33", "系统错误,请重新登录!");

	public static Message systemRoleError = new Message(null, "34", "权限不足!");

	public static Message LOGINNOTUSER = new Message(null, "35", "用户不存在或token错误!");

	public static Message loginError = new Message(null, "36", "账号或密码错误!");

	public static Message tokenError = new Message(null, "37", "token异常,请重新登录!");

	public static Message tokenSessionError = new Message(null, "38", "登录已经过期!");

	public static Message oldPasswordError = new Message(null, "39", "原密码不正确!");

	public static Message addErrorCodeShopError = new Message(null, "40", "渠道商不存在!");

	public static Message addErrorCodeExistError = new Message(null, "41", "异常code已经存在!");

	public static Message shopexistError = new Message(null, "42", "渠道商不存在!");

	public static Message buscodeError = new Message(null, "43", "业务类型代码已经存在!");

	public static Message busnameError = new Message(null, "43", "业务类型名称已经存在!");

	public static Message operatorsError = new Message(null, "44", "运营商不存在!");

	public static Message provincialError = new Message(null, "45", "省份不存在!");

	public static Message busError = new Message(null, "46", "业务类型不存在!");

	public static Message shopexistOrUserError = new Message(null, "47", "渠道商不存在或信息错误!");

	public static Message productexistError = new Message(null, "49", "产品不存在!");

	public static Message productCodeexistError = new Message(null, "50", "产品面值和价格重复!");

	public static Message productBatchError = new Message(null, "51", "批量产品为空!");

	public static Message initAccountError = new Message(null, "53", "请先初始化账户!");

	public static Message refundOrderError = new Message(null, "54", "订单已经退款");

	public static Message eleAccountError = new Message(null, "55", "账号已经存在");

	public static Message eleAccount = new Message(null, "56", "数据错误");

	public static Message chargeAccountError = new Message(null, "57", "账号只能使用一个,请先关闭其他账号");

	public static Message chargeEleError = new Message(null, "58", "充值失败,当日号码已经充值过");

	public static Message chargeAmountError = new Message(null, "59", "充值失败,充值金额必须是整数");

	public static Message chargeOrderError = new Message(null, "60", "充值失败,上游订单不存在");

	public static Message eleNotLoginError = new Message(null, "61", "当前未登录账号");

	public static Message systemErrorParameter = new Message(null, "62", "系统错误!");

	public static Message notSupperNum = new Message(null, "63", "不支持的号段!");

	public static Message updateMatchDownProduct = new Message(null, "0" , "产品更改为自动匹配");

	/******************和教育******************/

	public static Message schoolerror = new Message(null, "54", "未找到学校 !");


	/*********************下游错误信息**************************/


	public static Message success = new Message(null, "1000", "订单提交成功!");

	public static Message shopNotexistErrorIP = new Message(null, "1001", "商户不存在或者商户IP错误!");

	public static Message shopParameterError = new Message(null, "1002", "参数错误,不能为空!");

	public static Message signError = new Message(null, "1003", "sign错误!");

	public static Message rechargeNumError = new Message(null, "1004", "充值数量错误,必须大于 0 !");

	public static Message shopNumError = new Message(null, "1005", "商家订单号已经存在 !");

	public static Message operatorError = new Message(null, "1006", "运营商错误 !");

	public static Message buscodeNotError = new Message(null, "1007", "未开通的业务类型 ,请检查运营商、省份、业务类型代码、电话号码是否正确!");

	public static Message phoneNumError = new Message(null, "1008", "未识别的号码!");

	public static Message rechargeSumError = new Message(null, "1009", "充值总金额错误 !");

	public static Message shopAmountError = new Message(null, "1010", "商户余额不足!");

	public static Message productDownError = new Message(null, "1011", "未找到产品!");

	public static Message notifyAddressError = new Message(null, "1012", "回调地址错误 !");

	public static Message shopNotexistError = new Message(null, "10013", "商户不存在或者商户编号错误!");

	public static Message faceValueError = new Message(null, "1014", "充值金额错误,必须大于 0 !");

	public static Message callParameterError = new Message(null, "1015", "回调参数错误 !");

	public static Message rechargeNumOperatorError = new Message(null, "1016", "充值号码与运营商不符!");

	public static Message provinceError = new Message(null, "1017", "充值号码省份地市与充值产品省份地市不正确!");

	public static Message provinceErrorweihu = new Message(null, "1017", "省份维护!");

	public static Message mobileError = new Message(null, "1018", "此号段禁止提单!");

	public static Message userCloseError = new Message(null, "1019", "渠道关闭,禁止提单!");

	//public static Message systemErrorMessage = new Message(null, "1020", "订单失败!");

	public static Message systemErrorMessageQuery = new Message(null, "1021", "订单异常!");

	public static Message callSuccess = new Message(null, "1000", "回调成功");

	/*********查询订单状态********/

	public static Message searchSuccess = new Message(null, "1000", "查询成功");

	public static Message searchFail = new Message(null, "1001", "查询失败");

	public static Message orderStatusError = new Message(null, "1002", "参数错误 !");

	public static Message searchSignError = new Message(null, "1003", "sign错误!");

	public static Message orderNot = new Message(null, "1004", "订单不存在");


	public static Message userCloseErrorJingheng = new Message(null, "40", "渠道关闭,禁止提单!");

	public static Message productDownErrorJingheng = new Message(null, "44", "未找到产品!");

	public static Message shopNotexistErrorIPJingheng = new Message(null, "12", "商户不存在或者商户IP错误!");

	public static Message shopNumErrorJingheng = new Message(null, "23", "商家订单号已经存在 !");

	public static Message searchSignErrorJingheng = new Message(null, "11", "sign错误!");

	public static Message provinceErrorJingheng = new Message(null, "25", "充值号码省份地市与充值产品省份地市不正确!");

	public static Message phoneNumErrorJingheng = new Message(null, "25", "未识别的号码!");

	public static Message shopAmountErrorJingheng = new Message(null, "42", "商户余额不足!");

	public static Message systemErrorMessageJingheng = new Message(null, "31", "订单异常!");
	/**
	 * 产品列表
	 */
	public static Message productListSuccess = new Message(null, "1000", "查询成功 !");

	public static Message productListError = new Message(null, "1001", "查询失败!");

	public static Message productSignError = new Message(null, "1003", "sign错误!");

	public static Message productError = new Message(null, "1002", "参数错误 !");

	/************账户余额查询**********/

	public static Message amountSuccess = new Message(null, "1000", "查询成功 !");

	public static Message amountError = new Message(null, "1001", "查询失败!");

	public static Message amountSignError = new Message(null, "1003", "sign错误!");

	public static Message amountParametersError = new Message(null, "1002", "参数错误 !");




	/**
	 * 执行成功返回
	 *
	 * @return
	 */
	public static String getLoginSucceed(String token) {
		Message	message = ResultMessage.succeed;
		JSONObject jobOut = new JSONObject();
		jobOut.put("data", token);
		jobOut.put("code", StringUtils.isBlank(message.getCode()) ? "0" : message.getCode());
		jobOut.put("message", StringUtils.isBlank(message.getMessage()) ? Config.SUCCESS : message.getMessage());
		return jobOut.toString();
	}


	/**
	 * 执行成功返回
	 *
	 * @param data
	 * @return
	 */
	public static String getSucceed(String data) {
		//Message	message = ResultMessage.succeed;
	    Message message = new Message(null, "0", Config.SUCCESS);
		JSONObject jobOut = new JSONObject();
		jobOut.put("data", StringUtils.isBlank(data) ? "" : data);
		jobOut.put("code", StringUtils.isBlank(message.getCode()) ? "0" : message.getCode());
		jobOut.put("message", StringUtils.isBlank(message.getMessage()) ? Config.SUCCESS : message.getMessage());
		return jobOut.toString();
	}

	public synchronized static String getSucceedOrder(String data) {
		//Message message = ResultMessage.success;
		Message message = new Message(null, "0", Config.SUCCESS);
		JSONObject jobOut = new JSONObject();
		jobOut.put("data", StringUtils.isBlank(data) ? "" : data);
		jobOut.put("code", StringUtils.isBlank(message.getCode()) ? "1000" : message.getCode());
		jobOut.put("message", StringUtils.isBlank(message.getMessage()) ? Config.SUCCESS : message.getMessage());
		return jobOut.toString();
	}

	/**
	 * 执行成功返回
	 *
	 * @return
	 */
	public static String getSucceed() {
		//Message message = ResultMessage.succeed;
		Message message = new Message(null, "0", Config.SUCCESS);
		JSONObject jobOut = new JSONObject();
		jobOut.put("data", StringUtils.isBlank(message.getData()) ? "" : message.getData());
		jobOut.put("code", StringUtils.isBlank(message.getCode()) ? "0" : message.getCode());
		jobOut.put("message", StringUtils.isBlank(message.getMessage()) ? Config.SUCCESS : message.getMessage());
		return jobOut.toString();
	}

	/**
	 * 执行失败返回
	 *
	 * @return
	 */
	public static String getFailt(String msg) {
		//Message message = ResultMessage.failt;
		Message message = new Message(null, "1", Config.Failt);
		JSONObject jobOut = new JSONObject();
		jobOut.put("data", "");
		jobOut.put("code", StringUtils.isBlank(message.getCode()) ? "1" : message.getCode());
		jobOut.put("message", StringUtils.isBlank(msg) ? Config.Failt : msg);
		return jobOut.toString();
	}
//
//	/**
//	 * 执行失败返回
//	 *
//	 * @param message
//	 * @return
//	 */
//	public static JSONObject getFailtJson(Message message) {
//		if (message == null) {
//			message = ResultMessage.failt;
//		}
//		JSONObject jobOut = new JSONObject();
//		jobOut.put("data", "");
//		jobOut.put("code", StringUtils.isBlank(message.getCode()) ? "1" : message.getCode());
//		jobOut.put("message", StringUtils.isBlank(message.getMessage()) ? Config.Failt : message.getMessage());
//		return jobOut;
//	}

	/**
	 * 执行失败返回
	 *
	 * @return
	 */
	public static String getFailt(Message  message) {
		JSONObject jobOut = new JSONObject();
		jobOut.put("data", "");
		jobOut.put("code", StringUtils.isBlank(message.getCode()) ? "1" : message.getCode());
		jobOut.put("message", StringUtils.isBlank(message.getMessage()) ? Config.Failt : message.getMessage());
		return jobOut.toString();
	}
}
